/******************************************************************************
    Filename: hal_mcu.c

    Copyright 2007 Texas Instruments, Inc.
******************************************************************************/

#include  "Typedef.h"
#include  "board.h"
#include  "macros.h" 
#include  "hal_avr.h"
#include  "hal_mcu.h"



//----------------------------------------------------------------------------------
//  void halMcuInit(void)
//
//  DESCRIPTION:
//    Turn off watchdog and set up system clock. Set system clock to 4 MHz using
//    external crystal at 32 kHz
//
//  ARGUMENTS:
//    None
//
//  RETURNS:
//    None
//----------------------------------------------------------------------------------
void halMcuInit(void)
{
   MCU_IO_OUTPUT(BEEP_GPIO_PORT,BEEP_GPIO_PIN,0);
   MCU_IO_OUTPUT(LED0_GPIO_PORT,LED0_GPIO_PIN,1);
   MCU_IO_OUTPUT(LED1_GPIO_PORT,LED1_GPIO_PIN,1);
   MCU_IO_OUTPUT(LED2_GPIO_PORT,LED2_GPIO_PIN,1);
}


//-----------------------------------------------------------------------------
//  void halMcuWaitUs(INT16U usec)
//
//  DESCRIPTION:
//    Busy wait function. Waits the specified number of microseconds. Use
//    assumptions about number of clock cycles needed for the various instructions.
//    The duration of one cycle depends on MCLK. In this HAL, it is set
//    to 4 MHz, thus 4 cycles per usec.
//
//    NB! This function is highly dependent on architecture and compiler!
//-----------------------------------------------------------------------------
/*
void halMcuWaitUs(INT16U usec) 
{
   _delay_us(usec);  
}                         
*/


//-----------------------------------------------------------------------------
//  void halMcuSetLowPowerMode(INT8U mode)
//
//  DESCRIPTION:
//    Sets the MCU in a low power mode. Will turn global interrupts on at
//    the same time as entering the LPM mode. The MCU must be waken from
//    an interrupt (status register on stack must be modified).
//-----------------------------------------------------------------------------
void halMcuSetLowPowerMode(INT8U mode)
{

}